<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">/*
 * Copyright (c) 2016 VUI(https://git.oschina.net/durcframework/vui) All rights reserved.
 */

;(function(){

<span id='VUI-Dialog'>/**
</span> * Dialog对话框&lt;br&gt;
 * &lt;pre&gt;
win = new VUI.Dialog({
	contentId:'win'
	,title:'Dialog标题'
	,width:500
	,onOk:function() {
		alert('ok')
	}
});
 &lt;/pre&gt;
 * @class VUI.Dialog
 * @extends VUI.Win
 */
VUI.Class('Dialog',{
	OPTS:{
<span id='VUI-Dialog-cfg-maximizable'>		/**
</span>		 * @cfg {Boolean} maximizable
		 */
		maximizable:false
<span id='VUI-Dialog-cfg-minimizable'>		/**
</span>		 * @cfg {Boolean} minimizable
		 */
		,minimizable:false
<span id='VUI-Dialog-cfg-collapsible'>		/**
</span>		 * @cfg {Boolean} collapsible
		 */
		,collapsible:false
<span id='VUI-Dialog-cfg-noCancelBtn'>		/**
</span>		 * @cfg {Boolean} noCancelBtn 如果为true没有取消按钮
		 */
		,noCancelBtn:false
<span id='VUI-Dialog-cfg-okText'>		/**
</span>		 * @cfg {String} okText 确定按钮文本
		 */
		,okText:'确定'
<span id='VUI-Dialog-cfg-cancelText'>		/**
</span>		 * @cfg {String} cancelText 取消按钮文本
		 */
		,cancelText:'取消'
<span id='VUI-Dialog-cfg-onOk'>		/**
</span>		 * @cfg {Function} onOk 点确定触发的方法
		 */
		,onOk:function() {
			
		}
<span id='VUI-Dialog-cfg-onCancel'>		/**
</span>		 * @cfg {Function} onCancel 点取消触发的方法,默认关闭窗口
		 */
		,onCancel:function() {
			this.hide();
		}
		,buttons:null
	}
<span id='global-method-constructor'>	/**
</span>	 * 构造函数
	 * @constructor
	 * @ignore
	 */
	,init:function(opts) {
		this._super(opts);
		
		this.buildDefButtons();
	}
<span id='global-method-getViewClass'>	/**
</span>	 * @ignore
	 */
	,getViewClass:function() {
		return VUI.DialogView;
	}
<span id='global-method-buildDefButtons'>	/**
</span>	 * @ignore
	 */
	,buildDefButtons:function() {
		var that = this;
		var buttons = this.opt('buttons');
		
		if(!buttons) {
			buttons = [
			 	{text:this.opt('okText'),handler:function(){
			 		var onOk = that.opt('onOk');
			 		onOk &amp;&amp; onOk.call(that);
			 	}}
			]
			
			if(!this.opt('noCancelBtn')) {
				var cancelBtn = {text:this.opt('cancelText'),handler:function(){
			 		var onCancel = that.opt('onCancel');
			 		if(onCancel) {
			 			onCancel.call(that);
			 		}else{
			 			that.hide();
			 		}
			 	}};
				buttons.push(cancelBtn);
			}
			
			this.opt('buttons',buttons);
		}
	}
	
},VUI.Win);

})();</pre>
</body>
</html>
